﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-4-18
/// Purpose: 		路由表配置节类定义文件
/// ****************************************************************************
/// Modify By		Date			Remark
/// Robin           2012-12-14      增加一个disable属性，可以禁用mvc路由
/// ****************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace RB.Web.Mvc
{
    /// <summary>
    /// 路由表配置节类
    /// </summary>
    public class RoutesConfigSection : ConfigurationSection
    {
        [ConfigurationPropertyAttribute("ignoreRoute", DefaultValue = "{resource}.axd/{*pathInfo}")]
        public string IgnoreRoute
        {
            get
            {
                return (string)this["ignoreRoute"];
            }
            set
            {
                this["ignoreRoute"] = value;
            }
        }

        /// <summary>
        /// 用于禁用路由，默认值为false
        /// </summary>
        [ConfigurationPropertyAttribute("disabled", DefaultValue = false)]
        public bool Disabled
        {
            get
            {
                return (bool)Convert.ToBoolean(this["disabled"]);
            }
            set
            {
                this["disabled"] = value;
            }
        }

        [ConfigurationProperty("routes")]
        public RouteConfigCollection Routes
        {
            get
            {
                if (!this.Properties.Contains("routes"))
                {
                    this["routes"] = new RouteConfigCollection();
                }
                return (RouteConfigCollection)this["routes"];
            }
        }
    }
}
